package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    //根据多个菜品id查询对应的套餐id
    //select setmeal_id from setmeal dish where dish_id in (1,2,3,4...)
    List<Long> getSetmealByDishIds(List<Long> dishIds);


    //这个不需要添加创建时间和更新时间
    void insertBatch(List<SetmealDish> setmealdishs);

    //删除套餐相关菜品
    void deleteByIds(@Param("setmealIds") List<Long> setmealIds);


    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getByDishId(Long id);
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deleteById(Long id);
}
